package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.dao.UserMapper;
import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author itheima
 * @Date 2022/5/3 9:18
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public User queryUser(Long id) {
        return userMapper.selectById(id);
    }

    @Override
    public PageInfo<User> queryPage(Integer pageNum, Integer pageSize) {
        //1.设置参数
        PageHelper.startPage(pageNum, pageSize);
        //2.查询列表
        List<User> users = userMapper.selectList();
        //3.拼接sql  select * from user limit (pageNum-1)*pageSize,pageSize
        PageInfo<User> pageInfo = new PageInfo<>(users);
        return null;
    }
}
